<template lang="html">
  <div v-if="detail" :class="'news-card ' + 'news-card-'+type" @click="routeTo('/modules/news/detail?id='+detail.id)">
    <div class="title">
      {{ detail.title }}
    </div>
    <div class="info">
      <p>
        <span class="tags">
          {{ detail.classes }}
        </span>
        <span class="date">
          {{ detail.addtime }}
        </span>
      </p>
      <div class="group-info">
        <div class="group-wrap">
          <span class="group group-eye">
            <i>
              <img class="max" src="/static/modules/news/information_icon_see@2x.png" alt="">
            </i>
            <font>{{ detail.read }}</font>
          </span>
          <span class="group group-zan">
            <i>
              <img class="max" src="/static/modules/news/information_icon_heart@2x.png" alt="">
            </i>
            <font>{{ detail.like_count }}</font>
          </span>
          <span class="group group-share">
            <i>
              <img class="max" src="/static/modules/news/information_icon_share@2x.png" alt="">
            </i>
            <font>{{ detail.tran_count }}</font>
          </span>
        </div>
        <div class="do-zan" @click="clickZan" v-if="type != 'list'">
          <img class="max" v-if="detail.is_like" src="/static/modules/news/information_icon_like_press@2x.png">
          <img class="max" v-else src="/static/modules/news/information_icon_like_no r@2x.png">
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ['detail', 'type'],
  created() {
    console.log(this.detail)
  },
  methods: {
    clickZan() {
      this.$emit('clickZan', this.detail.id)
    }
  }
}
</script>

<style lang="scss" scoped>
.news-card{
  background-color: #fff;
  box-shadow:0px 0px 23px 0px rgba(222,222,223,1);
  border-radius: .3rem;
  margin: 0 auto;
  width: 90%;
  position: relative;
  z-index: 2;
  padding: .5rem;
  transform: translate(0, -50%);
  padding-bottom: .8rem;
  .title{
    font-size: .44rem;
    font-weight: 600;
    color: #191919;
    letter-spacing: 2px;
  }
  p{
    margin-top: .3rem;
    overflow: hidden;
    position: relative;
    .tags{
      color: #4F80FF;
    }
    .date{
      color: #A09A9B;
      margin-left: .2rem;
    }
  }
  .group-info{
    padding-top: .3rem;
  }
  .group-wrap{
    float: left;
    .group {
      margin-right: .1rem;
      i{
        display: inline-block;
        width: .5rem;
      }
      font{
        font-size: .32rem;
        color: #A09A9B;
      }
    }
  }
  .do-zan{
    position: absolute;
    right: 0;
    width: 2.2rem;
    bottom: .1rem;
  }
}
.news-card-list{
  p{
    padding-bottom: .3rem;
    border-bottom: 1px solid #EDEDED;
  }
}
</style>
